package cl.mobiquos.sendcode;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import cl.mobiquos.data.CodeData;

public class CodesDataAdapter extends ArrayAdapter<CodeData> {

	private List<CodeData> items;
	private Context ctx;

    public CodesDataAdapter(Context context, int textViewResourceId, List<CodeData> items) {
            super(context, textViewResourceId, items);
            this.items = items;
            this.ctx = context;
    }
    @Override 
    public View getView(int position, View convertView, ViewGroup parent) {
            View v = convertView;
            if (v == null) {
                LayoutInflater vi = (LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = vi.inflate(R.layout.row, null);
            }
            CodeData o = items.get(position);
            if (o != null) {
            	TextView nameCodeRequest = (TextView)v.findViewById(R.id.nameCode);
            	nameCodeRequest.setTextSize(30);
            	
                if (nameCodeRequest != null) {
                	nameCodeRequest.setText(o.getName());
                }                                        	                        
            }
            return v;
    }
   
}


